﻿// Copyright (c) 2012 - 2020 Jared Zheng <jaredz at outlook dot com>
// Buddha Framework is licensed under Mulan PSL v2.
// You can use this software according to the terms and conditions of the Mulan PSL v2.
// You may obtain a copy of Mulan PSL v2 at:
//          http://license.coscl.org.cn/MulanPSL2
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
// MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
// See the Mulan PSL v2 for more details.
//
// Create : 2012-12-01 version 0.1 Jared Zheng <jaredz at outlook dot com>
// Update : 2018-12-05 version 3.1.5 Jared Zheng <jaredz at outlook dot com>

#ifndef __BALANCE_DLG_H__
#define __BALANCE_DLG_H__

#pragma once

#include "CommonDlg.h"

///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// 授权均衡服务器界面对话框
class CBalanceDlg : public CCommonDlg
{
public:
    CBalanceDlg(void);
    virtual ~CBalanceDlg(void);

    XDECLARE_DLG_ID_WND_EXCHANGE( CBalanceDlg )
protected :
    virtual LRESULT OnInitDialog(void) OVERRIDE;

    LRESULT OnSize(WPARAM wParam, LPARAM lParam, BOOL& bHandled);

    XBEGIN_INLINE_MSG_MAP( CBalanceDlg )
    // {{ --
        XMSG_HANDLER(WM_SIZE, OnSize)
    // --}}
    XEND_CHAIN_MSG_MAP( CXDlg )
private:
    virtual void OnLive(bool bStart) OVERRIDE;
    virtual void OnLink(Int nServerIndex, uintptr_t utData) OVERRIDE;
    virtual void OnUpdate(Int nServerIndex, uintptr_t utData) OVERRIDE;
    virtual void OnSync(Int nServerIndex, uintptr_t utData) OVERRIDE;
    virtual void OnSync(Int nServerIndex, CStream& Stream) OVERRIDE;
    virtual void OnUnlink(Int nServerIndex, uintptr_t utData) OVERRIDE;

    virtual void UpdateServerInfo(void) OVERRIDE;

    virtual CXListView* GetListView(Int nServerIndex) OVERRIDE;
private:
    UInt         m_uBalanceAuthor;
    UInt         m_uBalanceWLAddr;
    UInt         m_uBalanceLoad;
    UInt         m_uAuthorCount;
    UInt         m_uAuthorOnline;
    UInt         m_uAuthorTotal;
    CXStatic     m_ConnectCenter;
    CXStatic     m_UDPExternal;
    CXStatic     m_ServerInfo;
    CXListView   m_AuthorSvr;
};

#endif // __BALANCE_DLG_H__
